<body>
		<div class="layout">
			<!--header-->
			<div class="wrapper">
				<div class="header">
					<a class="s_preson" href="{:U('Users/address')}" target="_blank"> < </a>
					<div class="store">
						<span>添加地址</span>
					</div>
					<div class="s_preson_right">
						<i class="s_icon s_preson_right_btn"></i>
					</div>
				</div>
			</div>

            <form action="{:U('Users/addAddress')}" method="POST" name="addAddressForm" onsubmit="return verify()">
                <div class="add-address">
                    <ul>
                        <li><span>姓        名：</span><input type="text" class="addTips" name="name" /></li>
                        <li><span>手        机：</span><input type="text" class="addTips" name="tel" /></li>
                        <!--<li>-->
                            <!--<span>省        份：</span>-->
                                <!--<select class="select" name="province" onchange="addCity(this.value)">-->
                                    <!--<option value="">请选择：</option>-->
                                    <!--<volist name="province" id="ao">-->
                                        <!--<option value="{$ao.region_id}">{$ao.region_name}</option>-->
                                    <!--</volist>-->
                                <!--</select>-->
                            <!--<label>﹀</label>-->
                            <!--<em>(必填)</em>-->
                        <!--</li>-->
                        <li>
                            <span>市        区：</span>
                            <select class="select" name="city" onchange="addZone(this.value)">
                                <option value="52" selected="selected">北京(仅限北京地区)</option>
                            </select>
                            <label>﹀</label>
                            <em>(必填)</em>
                        </li>
                        <li>
                            <span>区县街道：</span>
                            <select class="select" name="zone" >
                                <option value="500">东城区</option>
                                <option value="501">西城区</option>
                                <option value="502">海淀区</option>
                                <option value="503">朝阳区</option>
                                <option value="504">崇文区</option>
                                <option value="505">宣武区</option>
                                <option value="506">丰台区</option>
                                <option value="507">石景山区</option>
                                <option value="508">房山区</option>
                                <option value="509">门头沟区</option>
                                <option value="510">通州区</option>
                                <option value="511">顺义区</option>
                                <option value="512">昌平区</option>
                                <option value="513">怀柔区</option>
                                <option value="514">平谷区</option>
                                <option value="515">大兴区</option>
                                <option value="516">密云县</option>
                                <option value="517">延庆县</option>
                            </select>
                            <label>﹀</label>
                            <em>(必填)</em>
                        </li>
                        <li><span>详细地址：</span><input type="text" class="addTips" name="address" /></li>
                    </ul>
                    <input type="submit" class="mian-address-btn" value="完成">
                </div>
            </form>
			<div class="footer">
				<p>©2015 北京食安城信息科技有限公司，并保留所有权利</p>
			</div>
		</div>
	</body>

    <script>

        function verify()
        {
            if(document.addAddressForm.name.value=="")
            {
                alert("姓名不能为空!");
                document.addAddressForm.name.focus();
                return false;
            }
            else if(document.addAddressForm.name.value.length>50)
            {
                alert("姓名字数为25");
                document.addAddressForm.name.focus();
                return false;
            }

            var myreg = /^(((13[0-9]{1})|159|153|150|152)+\d{8})$/;
            var tel=document.addAddressForm.tel.value;
            if(!myreg.test(tel))
            {
                alert("手机号格式不正确!");
                document.addAddressForm.tel.focus();
                return false;
            }

            if(document.addAddressForm.zone.value=="")
            {
                alert("请选择地区!");
                document.addAddressForm.zone.value.focus();
                return false;
            }
        }


        function addCity(province)
        {
            $.ajax({
                url:"{:U('Users/city')}",
                type:"POST",
                data:{
                    id:province
                },
                dataType:"html",
                timeOut:"1000",
                error: function(){alert('Error loading PHP document');},
                success: function(result){
                    $("#city").append(result);
                }
            });
        }

        function addZone(city_id)
        {
            alert("aaaaaa");
            $.ajax({
                url:"{:U('Users/zone')}",
                type:"POST",
                data:{
                    id:city_id
                },
                dataType:"html",
                timeOut:"1000",
                error: function(){alert('Error loading PHP document');},
                success: function(result){
                    $("#zone").append(result);
                }
            });
        }
    </script>
</html>

